﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CommonHelper
{
    public class LogHelper
    {
        private LogHelper()
        {
            LogHelper.SetConfig();
        }
        /// <summary>
        /// 系统运行日志
        /// </summary>
        public static readonly log4net.ILog logSysRun = log4net.LogManager.GetLogger("SysRun");
        /// <summary>
        /// 系统错误日志
        /// </summary>
        public static readonly log4net.ILog logSysErr = log4net.LogManager.GetLogger("SysErr");

        public static void SetConfig()
        {
            log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo(System.IO.Path.GetDirectoryName(Process.GetCurrentProcess().MainModule.FileName) + "\\Log4Net.config"));
            //log4net.Config.XmlConfigurator.Configure();
        }

        public static void SetConfig(FileInfo configFile)
        {
            log4net.Config.XmlConfigurator.Configure(configFile);
        }
    }
}
